// pages/eating/eating.js
Page({
  mixins: [require('../mixin/themeChanged')],

  /**
   * 页面的初始数据
   */
  data: {


    list: [
      {
      id: '1',
      name: '周一',
      pages: [{
        
        id: "1",
        name: "测试会议",
        
      },  
      {
        
        id: "1",
        name: "测试会议",
        
      }, 
    ]
      },

      {id: '2',
      name: '周二',
      pages: [{

        id: "1",
        name: "测试会议",
        
      }]
      }, 
      ],

  },



  kindToggle: function (e) {
    var id = e.currentTarget.id,
      list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    });
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    var that = this
    var city = wx.getStorageSync("city")
    var url = wx.getStorageSync("config")


    wx.request({
      url: url.service.homeUrl + '/eating/showeatingmenu',
      data: {
       city:city,
      },
      method: 'GET',
      dataType: 'json',
      responseType: 'text',
      success: (res) => {

        that.setData({
          list: res.data,
        })
      console.log(that.data.list)


      },
      fail: function (res) {},
      complete: function (res) {},
    })


  },

  changeTheme: function () {
    console.log(this.data);
    getApp().themeChanged(this.data.theme === 'light' ? 'dark' : 'light');
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})